{% extends '::base.html.twig' %}
{% block namespace %}xmlns:fb="http://www.facebook.com/2008/fbml"{% endblock %}

{% block javascript %}
	<script type="text/javascript">
		function goLogIn(){
			window.location = "{{ path('facebook_check') }}";
		}
		
		function onFbInit() {
			if (typeof(FB) != 'undefined' && FB != null ) {
			  	FB.Event.subscribe('auth.login', function(response) {
					setTimeout(goLogIn,500);
				});
		     }
		}
	</script>
{% endblock %}


{% block body %}
	{{ parent() }}
	{{ facebook_initialize({'xfbml': true, 'fbAsyncInit': 'onFbInit();'}) }}
	<h1>Login</h1>
	
	
	 	
		<div class="fb-login-button" scope="email,publish_stream">Log In Using Your Facebook Account</div>
		
		<div class="or">
                    <span style="text-decoration: line-through">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                    <span>&nbsp; OR &nbsp;</span>
                    <span style="text-decoration: line-through">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
        </div>
        
        <form action="{{ path('login_check') }}" method="get">
    		<div>
        		<input type="hidden" name="action" value="verify">
        		<input type="hidden" name="openid_identifier" value="https://www.google.com/accounts/o8/id">
        
        		<input type="submit" class="login-button google" value="Log In Using Your Google Account">
    		</div>
		</form>
		
		<div class="or">
                    <span style="text-decoration: line-through">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                    <span>&nbsp; OR &nbsp;</span>
                    <span style="text-decoration: line-through">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
        </div>
        
        <form action="{{ path('login_check') }}" method="get">
    		<div>
        		<input type="hidden" name="action" value="verify">
        		<input type="hidden" name="openid_identifier" value="http://me.yahoo.com">
        
        		<input type="submit" class="login-button yahoo" value="Log In Using Your Yahoo Account">
    		</div>
		</form>
		
		<div class="or">
                    <span style="text-decoration: line-through">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                    <span>&nbsp; OR &nbsp;</span>
                    <span style="text-decoration: line-through">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
        </div>
        
        <form id="login" action="{{ path('login_check') }}" method="post" style="color: gray">
			
			{% if error %}
		    	<div style="font-size: 12px; color:red" class="error">{{ error.message }}</div>
			{% endif %}
			
		    <div class="form-row">
		    	<label for="username">Username</label><br /><br />
		    	<input type="text" id="username" name="_username" value="{{ last_username }}" style="width: 225px" />
		    </div>
			
			<div class="form-row">
		    	<label for="password">Password</label><br /><br />
		    	<input type="password" id="password" name="_password" style="width: 225px" />
		    </div>
		
		    {#
		        If you want to control the URL the user is redirected to on success (more details below)
		        <input type="hidden" name="_target_path" value="/account" />
		    #}
		
		    <input type="submit" value="Login" class="grey-button" name="login" style="margin: 20px 0 0 10px;" />
		</form>
    
   {% endblock %}